//
//  NetworkPayViewController.m
//  Hxcsfw
//
//  Created by 企友软mac on 2018/2/28.
//  Copyright © 2018年 企友软mac. All rights reserved.
//

#import "NetworkPayViewController.h"
#import "NetworkPayCell.h"
#import "AddPayViewController.h"

@interface NetworkPayViewController ()<UITableViewDelegate, UITableViewDataSource, NetworkPayCellDelegate>

@property (nonatomic, strong)UITableView *tableView;
@property (nonatomic, strong)NSMutableArray *arrMpay;

@end

@implementation NetworkPayViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    _arrMpay = [NSMutableArray array];
    [self.view addSubview:self.tableView];
}

- (UITableView *)tableView {

    if (_tableView == nil) {

        _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, WSCREENH_WIDTH, WSCREENH_HEIGHT) style:UITableViewStylePlain];
        _tableView.delegate = self;
        _tableView.dataSource = self;
        self.tableView.estimatedRowHeight =0;
        self.tableView.estimatedSectionHeaderHeight =0;
        self.tableView.estimatedSectionFooterHeight =0;
        _tableView.showsVerticalScrollIndicator = YES;
        _tableView.bounces = YES;
        _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    }
    return _tableView;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 10;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {

    return 215;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *identCell = @"NetworkPayCell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identCell];
    if (cell == nil) {
        NetworkPayCell *payCell = [[[NSBundle mainBundle] loadNibNamed:@"NetworkPayCell" owner:self options:nil] lastObject];
        payCell.btnAdd.tag = indexPath.row;
        payCell.delegate = self;
        cell = payCell;
    }
    return cell;
}

- (void)delegatBtnClick:(UIButton *)button {

    WLog(@"%zd",button.tag);
    AddPayViewController *addPayVc = [[AddPayViewController alloc] init];
    addPayVc.title = @"网上缴费";
    [self.navigationController pushViewController:addPayVc animated:YES];
}

@end
